#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long m, x, a, b;
        double ans;
        cin>>m>>x>>a>>b;
        if(b)
        {
            double ans1 = (double)(a+m)/(a+m+b);
			
			long long t1 = m/x, t2 = m%x;
			if(t1 > b)
				t1 = b, t2 = m-b*x;
			double ans2 = (double)(a+t2)/(a+t2+b-t1);
            if(ans1 - ans2 >= 0)
            	ans = ans1;
            else
            	ans = ans2;
            if(ans - 1 > 0)
            	ans = 1;
        }
        else
        {
            ans = 1;
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;
}
